#include "syscall.h"
#include "stdio.h"
#include "stdlib.h"

int main(int argc, char **argv)
{
	int fd, i;
	if(argc < 3)
	{
		printf("Usage: file_test <file name> <text for file>\n");
		return -1;
	}

	fd = creat(argv[1]);

	if(fd == -1)
	{
		printf("error creating and opening file\n");
		exit(-1);
	}

	char eol[] = "\n";
	for(i = 2; i < argc; i++)
	{
		write(fd, argv[i], strlen(argv[i]));
		write(fd, eol, strlen(eol));
	}

	close(fd);
	return 0;
}
